package com.rd.sys.service.sys.user.impl;

import baseproj.common.exception.BaseServiceException;
import baseproj.inter.Message;

/**
 * The Class UserInfoServiceException.
 */
public class UserInfoServiceException extends BaseServiceException {

    /** The Constant serialVersionUID. */
    private static final long serialVersionUID = 1L;

    public static final int ACCOUNT_NAME_EXIT = 1;
    public static final int CREATE_BASE_KEY_ERROR = 2;
    public static final int PASSWORD_NOT_EQUAL_CONFIRMPWD = 3;
    public static final int PASSWORD_RULE_ERROR = 4;
    public static final int CONFIRMPWD_RULE_ERROR = 5;
    public static final int OLD_PASSWORD_ERROR = 6;

    /**
     * Instantiates a new user info service exception.
     * 
     * @param erroCode
     *            the erro code
     */
    public UserInfoServiceException(int erroCode) {
        super(erroCode);
        if (erroCode == ACCOUNT_NAME_EXIT) {
            // 用户登录账号名称已存在
            this.setErroDesc(Message.getMessage("sys.operator.exit.account"));
        }
        if (erroCode == CREATE_BASE_KEY_ERROR) {
            // 生成Basekey错误
            this.setErroDesc(Message.getMessage("user.info.create.basekey.error"));
        }
        if (erroCode == PASSWORD_NOT_EQUAL_CONFIRMPWD) {
            // 密码和确认密码不同
            this.setErroDesc(Message.getMessage("sys.operator.pwd.disaccord"));
        }
        if (erroCode == PASSWORD_RULE_ERROR) {
            // 密码不符合安全规则
            this.setErroDesc(Message.getMessage("user.info.password.rule.error"));
        }
        if (erroCode == CONFIRMPWD_RULE_ERROR) {
            // 密码不符合安全规则
            this.setErroDesc(Message.getMessage("user.info.password.rule.error"));
        }
        if (erroCode == OLD_PASSWORD_ERROR) {
            // 密码不符合安全规则
            this.setErroDesc(Message.getMessage("user.info.password.oldpwd.error"));
        }
    }
}
